<template>
  <el-container class="container">
    <!-- <el-aside width="200px"
              :class="$store.state.app.collapse?'shrink':'expand'"> -->
    <el-aside class="divWidth" :style="{width:mW}">
      <!-- 导航菜单栏 -->
      <nav-bar></nav-bar>
    </el-aside>
    <el-container>
      <el-header>
        <!-- 头部区域 -->
        <head-bar></head-bar>
      </el-header>
      <!-- 主内容区域 -->
      <main-content></main-content>
      <!-- <el-main>
      </el-main> -->
    </el-container>
  </el-container>
</template>
<script>

import bus from "../bus/bus"
import HeadBar from "./layoutbar/HeadBar"
import NavBar from "./layoutbar/NavBar"
import MainContent from "./layoutbar/MainContent"
import Breadcrumb from "./layoutbar/Breadcrumb"
import { mapState } from "vuex";

export default {
    computed: {
    ...mapState({
      appName: (state) => state.app.appName,
      themeColor: (state) => state.app.themeColor,
      collapse: (state) => state.app.collapse,
      navTree: (state) => state.menu.navTree,
    }),
    },
  data () {
    return {
      widowsStyle: "",
      mW: "200px",
    }
  },
  mounted () {
     bus.$on("menuw", (e) => {
      if (this.collapse) {
        this.mW = "65px";
      } else {
        this.mW = "200PX";
      }
    });

  },
  methods: {
    getclass (msg) {
      this.$message({ message: msg, type: 'error' })
      this.widowsStyle = msg
    }
  },
  components: {
    HeadBar,
    NavBar,
    MainContent,
    Breadcrumb
  },
}
</script>

<style scoped lang="scss">
.container {
  height: 100%;
  overflow-x: hidden;
  background-color: burlywood;
}
.expand {
  width: 200px !important;
  overflow-x: hidden;
}
.shrink {
  width: 65px !important;
  overflow-x: hidden;
}
//  .content{
//    min-height: calc(100vh);
//  }
.divWidth{
    transition: width 1s;
    -webkit-transition: width 0.3s; /* Safari */
     transition-timing-function: linear;
}
</style>
